package com.tjcd.project.library_base.common.utils;

import android.app.Activity;
import android.app.Application;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.blankj.utilcode.util.LogUtils;

/**
 * @Author jiangKunKun
 * @CreateDate 2021/11/10
 * @Description activity数据反劫持
 * @SpittingGrooves
 */
public class ActivityLifeCycleImpl implements Application.ActivityLifecycleCallbacks{
    private static final String TAG = "ActivityLifeCycleImpl";
    @Override
    public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
        LogUtils.e(TAG,"onActivityCreated" + activity.getClass().getName());
        // 移除通知
        HijackingPrevent.getInstance().removeNotify();

    }

    @Override
    public void onActivityStarted(@NonNull Activity activity) {

    }

    @Override
    public void onActivityResumed(@NonNull Activity activity) {
        LogUtils.e(TAG,"onActivityResumed");
        // 移除通知
        HijackingPrevent.getInstance().removeNotify();
    }

    @Override
    public void onActivityPaused(@NonNull Activity activity) {
        LogUtils.e(TAG,"onActivityPaused");
        // 延时通知
        HijackingPrevent.getInstance().delayNotify(activity);
    }

    @Override
    public void onActivityStopped(@NonNull Activity activity) {
        LogUtils.e(TAG,"onActivityStopped");
    }

    @Override
    public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {

    }

    @Override
    public void onActivityDestroyed(@NonNull Activity activity) {

    }
}
